package com.yjd.bi.user.service.impl;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;
import org.springframework.stereotype.Service;

import com.yjd.comm.base.dao.IBaseDao;
import com.yjd.comm.base.service.impl.BaseServiceImpl;
import com.yjd.bi.user.model.UserGrowingRuleModel;
import com.yjd.bi.user.service.IUserGrowingRuleService;
import com.yjd.bi.user.dao.IUserGrowingRuleDao;

/**
 * <b>description</b>：用户成长系统-规则信息业务实现<br>
 * <b>time</b>：2018-08-13 15:20:05 <br>
 * <b>author</b>：  yangchangyan@yijiedai.com
 */
@Service("userGrowingRuleService")
public class UserGrowingRuleServiceImpl extends BaseServiceImpl implements IUserGrowingRuleService {

	/**
	 * 插入
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public UserGrowingRuleModel insert(UserGrowingRuleModel model) throws Exception {
		return this.userGrowingRuleDao.insertModel(model, true);
	}

	/**
	 * 更新
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public int update(UserGrowingRuleModel model) throws Exception {
		return this.userGrowingRuleDao.updateModel(model, true);
	}

	/**
	 * 根据id删除
	 * 
	 * @param rule_id
	 * @return
	 * @throws Exception
	 */
	public int delete(long rule_id) throws Exception {
		Map<Object, Object> paramMap = new HashMap<Object, Object>();
		paramMap.put("rule_id", rule_id);
		return this.userGrowingRuleDao.deleteModel(paramMap, true);
	}

	@Resource
	private IUserGrowingRuleDao userGrowingRuleDao;

	@Override
	public IBaseDao getBaseDao() {
		return this.userGrowingRuleDao;
	}

}
